package com.pqmvc{
	public class PQMediator extends PQMVC{
		private var commandDict:Object={};
		private var controlDict:Object={};
		public var proxy:Object;
		public function PQMediator()	{
			for each(var i in EventList)addListen(i,eventHandle);
		}
		private function eventHandle(...args):void{
			execute.apply(null,args);
		}
		protected function execute(type:String,param:Object=null):void{
			
		}
		public function get EventList():Array{
			return [];
		}
		protected function regController(name:String,c:Class):void{
			controlDict[name]=new c();
			controlDict[name].Mediator=this;
		}
		public function control(name:String,param:Object=null,type:String=null):void{
			if(controlDict[name])controlDict[name].execute(param,type);
			else throw new Error("控制器"+name+"未注册");
		}
		protected function regCommand(name:String,c:Class):void{
			commandDict[name]=new c();
			commandDict[name].Mediator=this;
		}
		public function command(name:String,param:Object=null,type:String=null):void{
			if(commandDict[name])commandDict[name].execute(param,type);
			else throw new Error("逻辑类"+name+"未注册");
		}
	}
}